<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>

    </style>
</head>
<body>
<p></p>
<script src="../MyJs.js"></script>
<script>
    var P=document.getElementsByTagName("p")[0];
    fn();
    setInterval(function(){
        fn();
    },1000);
    function fn(){
        var myTime=new Date();
        var Year=myTime.getFullYear();
        var Month=myTime.getMonth()+1;
        var Day=myTime.getDate();
        var Hour=myTime.getHours();
        var Minute=myTime.getMinutes();
        var Second=myTime.getSeconds();
        var Week=myTime.getDay();
        switch(Week){
            case 1:Week="一"; break;
            case 2:Week="二"; break;
            case 3:Week="三"; break;
            case 4:Week="四"; break;
            case 5:Week="五"; break;
            case 6:Week="六"; break;
            default:case 0:Week="日"; break;
        }
        var str=addZ(Year)+"年"+addZ(Month)+"月"+addZ(Day)+"日"+addZ(Hour)+"时"+addZ(Minute)+"分"+addZ(Second)+"秒"+" "+"星期"+Week;
        P.innerHTML=str;
        function addZ(num){
            return num=num<10?"0"+num:num+"";
        }
    }

</script>
</body>
</html>